#ifndef FREEWAYRECEIVER_H_INCLUDED
#define FREEWAYRECEIVER_H_INCLUDED
#include <iostream>
#include <string>
#define NORMALMSG 1
#define LOGINMSG 2
#define ERRORMSG 0


#include "../public/public0.h"

typedef struct sockaddr_in client;

class FreeWayEntry;
class FreeWayMgr;
class FreeWayReceiver:public Threadable{
public:
    FreeWayReceiver( FreeWayMgr * mgrPtr);
    ~FreeWayReceiver();
    virtual void svc();

    inline void setbrain(void * argp)
    {
        brain = argp;
    }

    inline void setEntry(FreeWayEntry * en)
    {
        entry = en;

    }

private:
    int parseHead(const char * );

    //get user name from login message
    std::string getUserInfo(const char *);

    FreeWayEntry * entry;

     bool run;

    FreeWayMgr * m_mgrPtr;

    boost::mutex m1;

    void * brain;

};




#endif // FREEWAYRECEIVER_H_INCLUDED
